package com.flute.haflute.jobbox.common;

import java.rmi.RemoteException;

import com.flute.haflute.jobbox.base.CloudResourceBase;
import com.flute.haflute.jobbox.base.InputResource;

/**
 * 非MapReduce计算的资源分发器代理类
 * 
 */
public class CloudResouceProxy extends CloudResourceBase {
	private static final long serialVersionUID = 1L;

	/** 被代理的inputResource */
	private InputResource source = null;

	public CloudResouceProxy(InputResource source) throws RemoteException {
		super();
		this.source = source;
	}

	/*
	 * (non-Javadoc)
	 */
	@Override
	public void addData(Object content) throws RemoteException {
		source.addData(content);
	}

	/*
	 * (non-Javadoc)
	 */
	@Override
	public Object getData(String taskNo) throws RemoteException {
		if (source == null)
			throw new RemoteException("no inputResource bound!");
		return source.getData(taskNo);
	}

	/*
	 * (non-Javadoc)
	 */
	@Override
	public String getId() throws RemoteException {
		return String.valueOf(System.currentTimeMillis());
	}

}
